﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class OnInputFieldEvent : MonoBehaviour
{

    private InputField input = null;
    public string onValueChange = "";
    public string onEndEdit = "";

    void Start()
    {
        this.input = this.gameObject.GetComponent<InputField>();
        if (this.input != null)
        {
            this.input.onValueChanged.AddListener(valueChange);
            this.input.onEndEdit.AddListener(endEdit);
        }
    }

    void Update()
    {

    }

    void valueChange(string value)
    {
        MonoBehaviour.print("on InputField value change value:" + value);
        if (this.onValueChange != "")
        {
            LuaHelper.getLuaModule().callScript(onValueChange, value);
        }
    }

    void endEdit(string value)
    {
        MonoBehaviour.print("on InputField end Edit value:" + value);
        if (this.onEndEdit != "")
        {
            LuaHelper.getLuaModule().callScript(onEndEdit, value);
        }
    }
}
